import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
// import { Tag } from 'ant-design-vue';
import { h } from 'vue';
// import { Switch } from 'ant-design-vue';
// import { setRoleStatus } from '/@/api/demo/system';
// import { useMessage } from '/@/hooks/web/useMessage';

export const columns: BasicColumn[] = [
  {
    title: '英文名称',
    dataIndex: 'tableCode',
    width: 200,
  },
  {
    title: '中文名称',
    dataIndex: 'tableName',
    width: 180,
  },

  {
    title: '所属分类',
    dataIndex: 'typeId',
    width: 100,
    customRender: ({ record }) => {
      const status = record.typeId;
      let text;
      switch (parseInt(status)) {
        // case 0:
        //   text = '普通数据表';
        //   break;
        case 1:
          text = '管理平台';
          break;
        case 2:
          text = '流转系统';
          break;
        case 3:
          text = '个人办公';
          break;
        case 4:
          text = '系统管理';
          break;
        case 5:
          text = '应用管理';
          break;
        case 6:
          text = '用户管理';
          break;
        case 7:
          text = '日志管理';
          break;
        default:
          text = '';
      }
      return h(() => text);
    },
  },
  {
    title: '表格类型',
    dataIndex: 'tableType',
    width: 100,
    customRender: ({ record }) => {
      const status = record.tableType;
      let text;
      switch (status) {
        case 0:
          text = '普通数据表';
          break;
        case 1:
          text = '分类存储表';
          break;
        case 2:
          text = '分类定义表';
          break;
        case 4:
          text = '子表';
          break;
        default:
          text = '';
      }
      return h(() => text);
    },
  },

  {
    title: '数据源',
    dataIndex: 'dataSourceConnName',
    width: 100,
  },
  {
    title: '更新时间',
    dataIndex: 'editDate',
    width: 180,
  },
  // {
  //   title: '发布时间',
  //   dataIndex: 'publicDate',
  //   width: 180,
  // },
  // {
  //   title: '备注',
  //   dataIndex: 'modelDesc',
  // },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'type',
    label: '数据库表格定义',
    component: 'Select',
    // required: true,
    componentProps: {
      options: [
        {
          label: '必选菜单',
          value: 0,
        },
        {
          label: '可选菜单',
          value: 1,
        },
        {
          label: '用户菜单',
          value: 2,
        },
      ],
    },
    colProps: { span: 6 },
  },
  {
    field: 'type2',
    label: '数据库',
    component: 'Select',
    // required: true,
    componentProps: {
      options: [
        {
          label: '必选菜单',
          value: 0,
        },
        {
          label: '可选菜单',
          value: 1,
        },
        {
          label: '用户菜单',
          value: 2,
        },
      ],
    },
    colProps: { span: 6 },
  },
  // {
  //   field: 'modelName3',
  //   label: '数据库',
  //   component: 'Input',
  //   // labelWidth: 68,
  //   colProps: { span: 6 },
  //   componentProps: {
  //     placeholder: '请选择数据库',
  //   },
  // },
];
